//
// Created by Administrator on 2021/10/9.
//

#include "Cube.h"

Cube::Cube() {
    size = 1.0f;
}

Cube::Cube(float size) : size(size){
}

void Cube::setUpAttribute() {
    vertex = {
            // v0-v1-v2-v3 front
            size, size, size,//0
            -size,size,size,//1
            -size,-size,size,//2
            size,size,size,//0
            -size,-size,size,//2
            size,-size,size,//3

            // v0-v3-v4-v5 right
            size, size, size,//0
            size,-size,size,//3
            size, -size, -size,//4
            size, size, size,//0
            size,-size,-size,//4
            size,size,-size,//5

            // v0-v5-v6-v1 up
            size, size, size,//0
            size,size,-size,//5
            -size,size,-size,//6
            size, size, size,//0
            -size,size,-size,//6
            -size,size,size,//1

            // v1-v6-v7-v2 left
            -size, size, size,//1
            -size, size, -size,//6
            -size,-size, -size,//7
            -size, size, size,//1
            -size,-size, -size,//7
            -size,-size,size,//2

            // v7-v4-v3-v2 bottom
            -size,-size,-size,//7
            size,-size,-size,//4
            size,-size,size,//3
            -size,-size,-size,//7
            size,-size,size,//3
            -size,-size,size,//2

            // v4-v7-v6-v5 back
            size,-size,-size,//4
            -size,-size,-size,//7
            -size, size, -size,//6
            size,-size,-size,//4
            -size, size, -size,//6
            size,size,-size,//5
    };

    color = {
            // front
            80/255.0, 70/255.0, 200/255.0, 255/255.0,
            80/255.0, 70/255.0, 200/255.0, 255/255.0,
            80/255.0, 70/255.0, 200/255.0, 255/255.0,
            80/255.0, 70/255.0, 200/255.0, 255/255.0,
            80/255.0, 70/255.0, 200/255.0, 255/255.0,
            80/255.0, 70/255.0, 200/255.0, 255/255.0,

            // right
            200/255.0,  70/255.0, 120/255.0, 255/255.0,
            200/255.0,  70/255.0, 120/255.0, 255/255.0,
            200/255.0,  70/255.0, 120/255.0, 255/255.0,
            200/255.0,  70/255.0, 120/255.0, 255/255.0,
            200/255.0,  70/255.0, 120/255.0, 255/255.0,
            200/255.0,  70/255.0, 120/255.0, 255/255.0,

            // top
            70/255.0, 200/255.0, 210/255.0, 255/255.0,
            70/255.0, 200/255.0, 210/255.0, 255/255.0,
            70/255.0, 200/255.0, 210/255.0, 255/255.0,
            70/255.0, 200/255.0, 210/255.0, 255/255.0,
            70/255.0, 200/255.0, 210/255.0, 255/255.0,
            70/255.0, 200/255.0, 210/255.0, 255/255.0,

            //left
            210/255.0, 100/255.0, 70/255.0, 255/255.0,
            210/255.0, 100/255.0, 70/255.0, 255/255.0,
            210/255.0, 100/255.0, 70/255.0, 255/255.0,
            210/255.0, 100/255.0, 70/255.0, 255/255.0,
            210/255.0, 100/255.0, 70/255.0, 255/255.0,
            210/255.0, 100/255.0, 70/255.0, 255/255.0,

            //bottom
            100/255.0, 70/255.0, 210/255.0, 255/255.0,
            100/255.0, 70/255.0, 210/255.0, 255/255.0,
            100/255.0, 70/255.0, 210/255.0, 255/255.0,
            100/255.0, 70/255.0, 210/255.0, 255/255.0,
            100/255.0, 70/255.0, 210/255.0, 255/255.0,
            100/255.0, 70/255.0, 210/255.0, 255/255.0,

            // back
            76/255.0, 210/255.0, 100/255.0, 255/255.0,
            76/255.0, 210/255.0, 100/255.0, 255/255.0,
            76/255.0, 210/255.0, 100/255.0, 255/255.0,
            76/255.0, 210/255.0, 100/255.0, 255/255.0,
            76/255.0, 210/255.0, 100/255.0, 255/255.0,
            76/255.0, 210/255.0, 100/255.0, 255/255.0,
    };
}



